//
//  XFModelTaibleViewController.m
//  名医通
//
//  Created by zyc on 16/7/12.
//  Copyright © 2016年 mr.zhou. All rights reserved.
//

#import "XFModelTaibleViewController.h"
#import "XFDiseaseSubdivisionModel.h"


#define diseaseModelID @"diseaseModelViewIndentifier"

@interface XFModelTaibleViewController () <UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,strong) UITableView *tableView;

@end


@implementation XFModelTaibleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];

    self.tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    [self.view addSubview:self.tableView];
    
    self.tableView.delegate = self;
    
    self.tableView.dataSource = self;

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.diseaseArray.count;

}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:diseaseModelID];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:diseaseModelID];
    
    }

    XFDiseaseSubdivisionModel *subDiseaseModel = self.diseaseArray[indexPath.row];
    
    cell.textLabel.text = subDiseaseModel.ci3_name;
    
    UIImageView *arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login_step"]];
    
    arrowView.frame = CGRectMake(0, 0, 15, 20);
    
    cell.accessoryView = arrowView;
    
    return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    XFDiseaseSubdivisionModel *subDisease = self.diseaseArray[indexPath.row];
    
    self.didSelectedSubDisease(subDisease.ci3_name);

    [self.navigationController popViewControllerAnimated:YES];

}

@end
